/*
 * Copyright (c) 2020-2099 the original author or authors. All rights reserve.
 */
package org.tianyun.cloud.config.autoconfigure;

import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Import;
import org.springframework.core.Ordered;
import org.springframework.core.annotation.Order;
import org.tianyun.cloud.config.console.ConsoleDiscoveryAnnotationRegistrar;
import org.tianyun.cloud.config.console.ConsolePropertySourceLocator;

/**
 * 配置中心自动配置类
 *
 * @auther ebert_chan
 */
@Configuration(proxyBeanMethods = false)
@Import(ConsoleDiscoveryAnnotationRegistrar.class)
public class CloudConfigBootstrapConfiguration {

    @Bean
    @ConditionalOnProperty(prefix = "spring.cloud.console.config", name = "server-addr")
    @Order(Ordered.HIGHEST_PRECEDENCE)
    public ConsolePropertySourceLocator cloudConfigPropertySourceLocator() {
        return new ConsolePropertySourceLocator();
    }

}
